package com.wsoft.oss.service;

import com.wsoft.oss.entity.OssFileEntity;
import com.wsoft.oss.query.FileInfoQuery;
import com.wsoft.oss.vo.FileUploadVO;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * @Author z001
 * @Date 2024/9/27 10:53
 */
public interface IOssFileService {

    /**
     * 根据id 返回二进制流
     * @param id 附件表id
     * @param picType 图片类型 原/大/中/小图
     * @param sessionId sessionID
     * @return
     * @throws Exception
     */
    Map<String,Object> get(Long id,Integer picType,String sessionId) throws Exception;

    /**
     * 分片下载
     * @param fileEntity
     * @param picType
     * @param sessionId
     * @param range
     * @param response
     * @return
     * @throws Exception
     */
    byte[] downloadPart(OssFileEntity fileEntity, Integer picType, String sessionId, String range, HttpServletResponse response) throws Exception;

    /**
     * 校验md5
     * @param md5 md5值
     * @param fileSize 文件大小
     * @return
     */
    FileUploadVO checkFileByMd5(String md5, Integer fileSize);

    /**
     * 获取文件最大值
     * @return
     */
    Long getFileMaxSize();

    /**
     * 校验sessionId
     * @param sessionId
     * @param bucketName
     */
    void checkSessionId(String sessionId,String  bucketName);

    /**
     * 获取文件详情
     * @param query
     * @return
     */
    List<OssFileEntity> getFileInfo(FileInfoQuery query);
}
